﻿using System.Windows;

namespace FunasrSTT.Translate.Services;

/// <summary>
/// 语言服务.
/// </summary>
public class LanguageService
{
    private readonly ResourceDictionary _resources;

    public LanguageService(ResourceDictionary resources)
    {
        _resources = resources;
    }

    /// <summary>
    /// 获取当前语言的国际化文本.
    /// </summary>
    /// <param name="key">文本键.</param>
    /// <param name="args">待替换值.</param>
    /// <returns>国际化文本.</returns>
    public string L(string key, params object[] args)
    {
        if (_resources[key] is string text)
        {
            return string.Format(text, args);
        }

        return string.Empty;
    }
}
